package com.wyu.servlet;

import com.alibaba.fastjson.JSON;
import com.wyu.dao.YGDao;
import com.wyu.dao.YGDaoImpl;
import com.wyu.pojo.YG;
import com.wyu.service.YGService;
import com.wyu.service.YGServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;

@WebServlet("/YGServlet")
public class YGServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        HttpSession session = request.getSession();
        YGDao dao = new YGDaoImpl();
        List<YG> list = dao.searchyg();
        session.setAttribute("yg",list);
        response.sendRedirect("ygxx.jsp");
        request.getSession().setAttribute("Deletemessage","");
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}
